/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fix.it.source.fixit;

import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jms.JMSException;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Biserka
 */
@Stateless
public class ReportProblemBean {
    @PersistenceContext(unitName="fix.it.source_FixIt_war_1.0-SNAPSHOTPU")
    private EntityManager entityManager;
    
    
    public void storeProblem(Problem p){
      Random rand = new Random();
      p.setId(rand.nextLong());
      entityManager.persist(p);
      JMSSender sender = new JMSSender();
      sender.sendMessageToAuthority(p);
    }   
}
